<template>
  <div id="container" style="width: 100%; height: 400px"></div>
</template>

<script>
export default {
  name: 'MapComponent',
  mounted() {
    this.initMap();
  },
  methods: {
    initMap() {
      var map = new AMap.Map('container', {
        zoom: 11, // 初始地图层级
        center: [116.397428, 39.90923], // 初始中心点
      });

      AMap.plugin('AMap.Marker', function() {
        var marker = new AMap.Marker({
          position: [116.397428, 39.90923], // 标记点位置
          map: map,
          clickable: true,
        });

        marker.on('click', () => {
          this.$router.push('/store'); // 假设门店详情页面路由为/store
        });
      });
    },
  },
};
</script>

<style scoped>
/* 你的样式 */
</style>
